<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%
String path = request.getContextPath();
String loginType = (String)request.getSession().getAttribute("loginType");
if(loginType == null || loginType.equals("3") || loginType.equals("2")) {
	response.sendRedirect("login.jsp");
} 
%>
<html>
	<head>
		<title>index.jsp</title>
		<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/btn_class.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/extjs/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/extjs/style.css" />
<script type="text/javascript"
	src="<%=path%>/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=path%>/extjs/ext-all.js"></script>


		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<style type="text/css">
	.sys_home {
        background-image:url(<%=path%>/extjs/icons/house.png);
    }
    .app_hzdw {
        background-image:url(<%=path%>/images/Profile.png);
    }
	.app_qygl {
        background-image:url(<%=path%>/images/Add.png);
    }
    .app_jcxx {
        background-image:url(<%=path%>/images/Comment.png);
    }
    .app_jbgl {
        background-image:url(<%=path%>/images/LineChart.png);
    }
    .app_tjfx {
        background-image:url(<%=path%>/images/PieChart.png);
    }
    .app_jcwh {
        background-image:url(<%=path%>/images/Save.png);
    }
    .app_xtgl {
        background-image:url(<%=path%>/images/Loading.png);
    }
    
    .app_exit {
        background-image:url(<%=path%>/images/Exit.png);
    }
    
    </style>
</head>

<body >
<script type="text/javascript">
Ext.onReady(function(){
	
	function client_loadNewPanel(nodeid, nodename, url, folder) {
	    
		var n = client_center.getComponent(nodeid);
		if (!n) {// 如果没有打开选项卡，打开
			client_center.add(new Ext.Panel(
					{
						id : nodeid,// 设置id
						title : nodename,
						//iconCls : iconcls,
						html : '<html><head></head><body><iframe name="ifr_table" id="ifr_table" scrolling="auto" frameborder="0" width="100%" height="100%" '
								+ 'src="' + folder + '/'
								+ url.replace('\/*', '')
								+ '"></iframe></body></html>',
						closable : true
					})).show();
		} else {// 否则显示该选项卡
			n.show();
		}
	}
	
	Ext.ux.TabCloseMenu = function(){
	    var tabs, menu, ctxItem;
	    this.init = function(tp){
	        tabs = tp;
	        tabs.on('contextmenu', onContextMenu);
	    }

	    function onContextMenu(ts, item, e){
	        if(!menu){ // create context menu on first right click
	            menu = new Ext.menu.Menu([{
	                id: tabs.id + '-close',
	                text: '关闭当前窗口',
	                handler : function(){
	                    tabs.remove(ctxItem);
	                }
	            },{
	                id: tabs.id + '-close-others',
	                text: '关闭其他窗口',
	                handler : function(){
	                    tabs.items.each(function(item){
	                        if(item.closable && item != ctxItem){
	                            tabs.remove(item);
	                        }
	                    });
	                }
	            },{
	                id: tabs.id + '-close-all',
	                text: '关闭所有窗口',
	                handler : function(){
	                    tabs.items.each(function(item){
	                        if(item.closable){
	                            tabs.remove(item);
	                        }
	                    });
	                }
	            }]);
	        }
	        ctxItem = item;
	        var items = menu.items;
	        items.get(tabs.id + '-close').setDisabled(!item.closable);
	        var disableOthers = true;
	        tabs.items.each(function(){
	            if(this != item && this.closable){
	                disableOthers = false;
	                return false;
	            }
	        });
	        items.get(tabs.id + '-close-others').setDisabled(disableOthers);
	        menu.showAt(e.getPoint());
	    }
	};
	
	var client_center = new Ext.TabPanel({
				activeTab : 0,
				border:false,
				plugins: new Ext.ux.TabCloseMenu(),
			    enableTabScroll:true,
				items : [{
				title : '首页',
				id : '0',
				iconCls : 'sys_home',
				closable : false
			}]
				});
	
	/**************
	*             *
	* 监测信息按钮群 *
	*             *
	**************/			
	var menu_jcxx = new Ext.menu.Menu();
    menu_jcxx.add({
        text: '血压监测',
           handler: function(){
           client_loadNewPanel("server_xyjc_id", "血压监测", "xyjc.jsp", "server");
       }
    });
    menu_jcxx.add({
        text: '血糖监测',
           handler: function(){
           client_loadNewPanel("server_xtjc_id", "血糖监测", "xtjc.jsp", "server");
       }
    });
    menu_jcxx.add({
        text: '血脂监测',
           handler: function(){
           client_loadNewPanel("server_xzjc_id", "血脂监测", "buginfo.jsp", "server");
       }
    });
    menu_jcxx.add({
        text: '血尿酸监测',
           handler: function(){
           client_loadNewPanel("server_xns_id", "血尿酸监测", "buginfo.jsp", "server");
       }
    });
    menu_jcxx.add({
        text: '血肌酐监测',
           handler: function(){
           client_loadNewPanel("server_xjg_id", "血肌酐监测", "buginfo.jsp", "server");
       }
    });
    menu_jcxx.add({
        text: 'BMI体质指数监测',
           handler: function(){
           client_loadNewPanel("server_BMI_id", "BMI体质指数监测", "buginfo.jsp", "server");
       }
    });
    menu_jcxx.add({
        text: '血氧饱和度监测',
           handler: function(){
           client_loadNewPanel("server_xybhd_id", "血氧饱和度监测", "buginfo.jsp", "server");
       }
    });
    menu_jcxx.add({
        text: '心电监测',
           handler: function(){
           client_loadNewPanel("server_xdjc_id", "心电监测", "buginfo.jsp", "server");
       }
    });
    
    /**************
	*             *
	* 统计分析---接收信息统计分析按钮群 *
	*             *
	**************/			
	var menu_jsxxtjfx = new Ext.menu.Menu();
    menu_jsxxtjfx.add({
        text: '血压监测信息统计分析',
           handler: function(){
           client_loadNewPanel("client_xyjcxxfx_id", "血压监测信息统计分析", "421_dyhzfx.jsp", "mould_published");
       }
    });
    menu_jsxxtjfx.add({
        text: '血糖监测信息统计分析',
           handler: function(){
           client_loadNewPanel("client_xtjcxxfx_id", "血糖监测信息统计分析", "422_qzhzfx.jsp", "mould_published");
       }
    });
    
    
    /**************
	*             *
	* 统计分析按钮群 *
	*             *
	**************/			
	var menu_tjfx = new Ext.menu.Menu();
    menu_tjfx.add({
        text: '化验检查统计分析',
           handler: function(){
           client_loadNewPanel("client_hyjc_id", "化验检查统计分析", "buginfo.jsp", "mould_published");
       }
    });
    menu_tjfx.add({
        text: '门诊用药统计分析',
           handler: function(){
           client_loadNewPanel("client_mzyy_id", "门诊用药统计分析", "buginfo.jsp", "mould_published");
       }
    });
    menu_tjfx.add({
        text: '接收信息统计分析',
        menu: menu_jsxxtjfx
    });
    menu_tjfx.add({
        text: '发送信息统计分析',
           handler: function(){
           client_loadNewPanel("client_fsxxfx_id", "发送信息统计分析", "buginfo.jsp", "mould_published");
       }
    });
    menu_tjfx.add({
        text: '单一患者管理分析',
           handler: function(){
           client_loadNewPanel("client_dyhzfx_id", "单一患者管理分析", "buginfo.jsp", "mould_published");
       }
    });
    menu_tjfx.add({
        text: '群组患者管理分析',
           handler: function(){
           client_loadNewPanel("client_qzhzfx_id", "群组患者管理分析", "buginfo.jsp", "mould_published");
       }
    });
    menu_tjfx.add({
        text: '患者用药分析',
           handler: function(){
           client_loadNewPanel("client_hzyyfx_id", "患者用药分析", "buginfo.jsp", "mould_published");
       }
    });
    
    
    /**************
	*             *
	* 基础维护按钮群 *
	*             *
	**************/			
	var menu_jcwh = new Ext.menu.Menu();
    menu_jcwh.add({
        text: '提醒告知基础设置',
           handler: function(){
           client_loadNewPanel("client_txgz_id", "提醒告知基础设置", "buginfo.jsp", "mould_published");
       }
    });
    menu_jcwh.add({
        text: '家庭成员信息维护',
           handler: function(){
           client_loadNewPanel("client_jtcy_id", "家庭成员信息维护", "buginfo.jsp", "mould_published");
       }
    });
    
    /**************
	*             *
	* 系统管理按钮群 *
	*             *
	**************/			
	var menu_xtgl = new Ext.menu.Menu();
    menu_xtgl.add({
        text: '用户管理',
           handler: function(){
           client_loadNewPanel("server_yhgl_id", "用户管理", "yhgl.jsp", "server");
       }
    });
    menu_xtgl.add({
        text: '机构管理',
           handler: function(){
           client_loadNewPanel("server_jggl_id", "机构管理", "jggl.jsp", "server");
       }
    });
    
    menu_xtgl.add({
        text: '修改密码',
           handler: function(){
           mod_password();
       }
    });
    
	
	var client_panel = new Ext.Panel({
        region: "center",
		layout:'fit',
		margins:'0 5 0 0',
        // autoScroll : true,
		tbar: [ {
                    xtype: 'buttongroup',
                   // title: 'User options',
                    autoWidth: true,
                    columns: 6,
                    defaults: {
                        xtype: 'button',
                        scale: 'large',
                        width: '100%',
                        iconAlign: 'left'
                    },
                    items: [{
                        text: '合作单位<br/>',
                        iconCls: 'app_hzdw',
                        handler: function(){
				            client_loadNewPanel("server_hzdw_id", "合作单位", "hzdw.jsp", "server");
				        }
                    }, {
                        iconCls: 'app_jcxx',
                        text: '监测信息<br/>',
                        menu: menu_jcxx
                    }, {
                        iconCls: 'app_jbgl',
                        text: '疾病管理<br/>',
                        handler: function(){
				            client_loadNewPanel("server_jbgl_id", "疾病管理", "jbgl.jsp", "server");
				        }
                    }, {
                        iconCls: 'app_tjfx',
                        text: '统计分析<br/>',
                        menu: menu_tjfx
                    }, {
                        iconCls: 'app_jcwh',
                        text: '基础维护<br/>',
                        menu: menu_jcwh
                    }, {
                        iconCls: 'app_xtgl',
                        text: '系统管理<br/>',
                        menu: menu_xtgl
                    } ]
                }, '->',{
                    xtype: 'buttongroup',
                    autoWidth: true,
                    columns: 2,
                    defaults: {
                        xtype: 'button',
                        scale: 'large',
                        width: '100%',
                        iconAlign: 'left'
                    },
                    items: [ {
                        iconCls: 'app_exit',
                        text: '退出系统<br/>',
                        handler : function() {
							if(confirm('确认退出吗?')) {
								Ext.Ajax.request( {
									url : 'myLogin!loginOut.do',
									params:{
					    	        	
						    	    },
									success : function() {
										window.location.href = "login.jsp";
									},
									failure : function() {
										window.location.href = "login.jsp";
									}
								});
							}
						}
                    }]
                }],
        items: [
           client_center, {
		                    region:'south',
		                    contentEl: 'south',
		                    split:false,
		                    height: 20,
		                    minSize: 20,
		                    maxSize: 20,
		                    collapsible: false,
		                   // title:'　',
		                    margins:'0 0 1 0'
		                }
        ]
    });
    
 	new Ext.Viewport( {
		layout : "border",
		items : [client_panel]
	});
	
});
</script>

</body>
</html>
